import axios from '../axios'

export const loginApi = {
	// 获取列表
	login: query => {
		return axios({
			url: '/login',
			method: 'post',
			data: query
		})
	},
	captcha: query => {
		return axios({
			url: '/captcha/captcha',
			method: 'get',
			params: query
		})
	}
}
export const userInfoApi = {
	// 获取列表
	info: query => {
		return axios({
			url: '/info',
			method: 'get',
			params: query
		})
	}
}
// 管理员管理
export const adminApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/admin/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/admin/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/admin/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/admin/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/admin/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/admin/delete',
			method: 'post',
			data: query
		})
	}
}

// 会员管理
export const userApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/user/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/user/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/user/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/user/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/user/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/user/delete',
			method: 'post',
			data: query
		})
	}
}

// 栏目管理
export const columnApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/column/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/column/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/column/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/column/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/column/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/column/delete',
			method: 'post',
			data: query
		})
	}
}

// 文章管理
export const articleApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/article/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/article/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/article/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/article/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/article/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/article/delete',
			method: 'post',
			data: query
		})
	},
    // 获取首页
    getTypeSort: query => {
        return axios({
            url: '/article/typeSort',
            method: 'get',
            params: query
        })
    },
}

// 标签管理
export const tabApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/tab/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/tab/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/tab/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/tab/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/tab/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/tab/delete',
			method: 'post',
			data: query
		})
	}
}

// 标签管理
export const commentApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/comment/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/comment/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/comment/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/comment/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/comment/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/comment/delete',
			method: 'post',
			data: query
		})
	}
}
// 菜单管理
export const menuApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/menu/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/menu/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/menu/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/menu/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/menu/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/menu/delete',
			method: 'post',
			data: query
		})
	}
}

// 角色管理
export const roleApi = {
	// 获取列表
	getList: query => {
		return axios({
			url: '/role/list',
			method: 'get',
			params: query
		})
	},
	// 获取列表
	getPage: query => {
		return axios({
			url: '/role/page',
			method: 'get',
			params: query
		})
	},
	// 增加
	addData: query => {
		return axios({
			url: '/role/add',
			method: 'post',
			data: query
		})
	},
	// 详情
	detailData: id => {
		return axios({
			url: '/role/info/' + id,
			method: 'get'
		})
	},
	// 修改
	updateData: query => {
		return axios({
			url: '/role/update',
			method: 'post',
			data: query
		})
	},
	// 删除
	delData: query => {
		return axios({
			url: '/role/delete',
			method: 'post',
			data: query
		})
	}
}
export const routerApi = {
	getRouter: query => {
		return axios({
			url: '/admin/getRouter',
			method: 'get',
			params: query
		})
	}
}
